package com.javaex.book.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import com.javaex.book.utils.JdbcUtils;
import com.javaex.book.utils.JedisUtils;

@WebListener
public class ServletContextListenerImpl implements ServletContextListener {

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		ServletContextListener.super.contextInitialized(sce); 
	}
	
	@Override 
	public void contextDestroyed(ServletContextEvent sce) {
		// 关闭数据库连接池
		JdbcUtils.closeDataSource();
		// 关闭Jedis连接池
		JedisUtils.closeJedisPool();
	}
}
